define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'ord.order/index',
        add_url: 'ord.order/add',
        edit_url: 'ord.order/edit',
        delete_url: 'ord.order/delete',
        export_url: 'ord.order/export',
        modify_url: 'ord.order/modify',
        stock_url: 'ord.order/stock_url',
        ord_detail: 'ord.order/ord_detail',
        modify_state: 'ord.order/modify_state',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar: ['refresh'],
                cols: [[
                    {field: 'order_no', width: 200, title: '订单号'},
                    {field: 'user_name', title: '下单用户',search: false},
                    {field: 'level_title', title: '购买等级',search: false},
                    {field: 'payable_money', title: '应付金额',search: false},
                    {field: 'paidin_money', title: '实付金额',search: false}, 
                    {field: 'status', title: '状态', selectList: {1: '待支付',2: '已支付',5: '已取消'}},
                    {field: 'create_time', title: '下单时间',search: false},
                    {title: '操作', templet: ea.table.tool,operat:[
                       [
                           {
                               text: '订单详情',
                               url: init.ord_detail,
                               method: 'open',
                               auth: 'edit',
                               class: 'layui-btn layui-btn-xs layui-btn-success',
                               extend: 'data-full="true"',
                           }
                      ]
                    ]},
                ]],
            });
            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
        ord_detail: function () {
            ea.listen();
        }
    };
    return Controller;
});